/**
 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.mpower.pc.service.persistence;

import com.liferay.portal.service.persistence.BasePersistence;

import com.mpower.pc.model.CommandHistory;

/**
 * The persistence interface for the command history service.
 *
 * <p>
 * Never modify or reference this interface directly. Always use {@link CommandHistoryUtil} to access the command history persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this interface.
 * </p>
 *
 * <p>
 * Caching information and settings can be found in <code>portal.properties</code>
 * </p>
 *
 * @author Sheikh Sajid
 * @see CommandHistoryPersistenceImpl
 * @see CommandHistoryUtil
 * @generated
 */
public interface CommandHistoryPersistence extends BasePersistence<CommandHistory> {
	/**
	* Caches the command history in the entity cache if it is enabled.
	*
	* @param commandHistory the command history to cache
	*/
	public void cacheResult(com.mpower.pc.model.CommandHistory commandHistory);

	/**
	* Caches the command histories in the entity cache if it is enabled.
	*
	* @param commandHistories the command histories to cache
	*/
	public void cacheResult(
		java.util.List<com.mpower.pc.model.CommandHistory> commandHistories);

	/**
	* Creates a new command history with the primary key. Does not add the command history to the database.
	*
	* @param id the primary key for the new command history
	* @return the new command history
	*/
	public com.mpower.pc.model.CommandHistory create(long id);

	/**
	* Removes the command history with the primary key from the database. Also notifies the appropriate model listeners.
	*
	* @param id the primary key of the command history to remove
	* @return the command history that was removed
	* @throws com.mpower.pc.NoSuchCommandHistoryException if a command history with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public com.mpower.pc.model.CommandHistory remove(long id)
		throws com.liferay.portal.kernel.exception.SystemException,
			com.mpower.pc.NoSuchCommandHistoryException;

	public com.mpower.pc.model.CommandHistory updateImpl(
		com.mpower.pc.model.CommandHistory commandHistory, boolean merge)
		throws com.liferay.portal.kernel.exception.SystemException;

	/**
	* Finds the command history with the primary key or throws a {@link com.mpower.pc.NoSuchCommandHistoryException} if it could not be found.
	*
	* @param id the primary key of the command history to find
	* @return the command history
	* @throws com.mpower.pc.NoSuchCommandHistoryException if a command history with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public com.mpower.pc.model.CommandHistory findByPrimaryKey(long id)
		throws com.liferay.portal.kernel.exception.SystemException,
			com.mpower.pc.NoSuchCommandHistoryException;

	/**
	* Finds the command history with the primary key or returns <code>null</code> if it could not be found.
	*
	* @param id the primary key of the command history to find
	* @return the command history, or <code>null</code> if a command history with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public com.mpower.pc.model.CommandHistory fetchByPrimaryKey(long id)
		throws com.liferay.portal.kernel.exception.SystemException;

	/**
	* Finds all the command histories where userId = &#63;.
	*
	* @param userId the user id to search with
	* @return the matching command histories
	* @throws SystemException if a system exception occurred
	*/
	public java.util.List<com.mpower.pc.model.CommandHistory> findByUserId(
		long userId) throws com.liferay.portal.kernel.exception.SystemException;

	/**
	* Finds a range of all the command histories where userId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param userId the user id to search with
	* @param start the lower bound of the range of command histories to return
	* @param end the upper bound of the range of command histories to return (not inclusive)
	* @return the range of matching command histories
	* @throws SystemException if a system exception occurred
	*/
	public java.util.List<com.mpower.pc.model.CommandHistory> findByUserId(
		long userId, int start, int end)
		throws com.liferay.portal.kernel.exception.SystemException;

	/**
	* Finds an ordered range of all the command histories where userId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param userId the user id to search with
	* @param start the lower bound of the range of command histories to return
	* @param end the upper bound of the range of command histories to return (not inclusive)
	* @param orderByComparator the comparator to order the results by
	* @return the ordered range of matching command histories
	* @throws SystemException if a system exception occurred
	*/
	public java.util.List<com.mpower.pc.model.CommandHistory> findByUserId(
		long userId, int start, int end,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException;

	/**
	* Finds the first command history in the ordered set where userId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param userId the user id to search with
	* @param orderByComparator the comparator to order the set by
	* @return the first matching command history
	* @throws com.mpower.pc.NoSuchCommandHistoryException if a matching command history could not be found
	* @throws SystemException if a system exception occurred
	*/
	public com.mpower.pc.model.CommandHistory findByUserId_First(long userId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException,
			com.mpower.pc.NoSuchCommandHistoryException;

	/**
	* Finds the last command history in the ordered set where userId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param userId the user id to search with
	* @param orderByComparator the comparator to order the set by
	* @return the last matching command history
	* @throws com.mpower.pc.NoSuchCommandHistoryException if a matching command history could not be found
	* @throws SystemException if a system exception occurred
	*/
	public com.mpower.pc.model.CommandHistory findByUserId_Last(long userId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException,
			com.mpower.pc.NoSuchCommandHistoryException;

	/**
	* Finds the command histories before and after the current command history in the ordered set where userId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param id the primary key of the current command history
	* @param userId the user id to search with
	* @param orderByComparator the comparator to order the set by
	* @return the previous, current, and next command history
	* @throws com.mpower.pc.NoSuchCommandHistoryException if a command history with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public com.mpower.pc.model.CommandHistory[] findByUserId_PrevAndNext(
		long id, long userId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException,
			com.mpower.pc.NoSuchCommandHistoryException;

	/**
	* Finds all the command histories.
	*
	* @return the command histories
	* @throws SystemException if a system exception occurred
	*/
	public java.util.List<com.mpower.pc.model.CommandHistory> findAll()
		throws com.liferay.portal.kernel.exception.SystemException;

	/**
	* Finds a range of all the command histories.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param start the lower bound of the range of command histories to return
	* @param end the upper bound of the range of command histories to return (not inclusive)
	* @return the range of command histories
	* @throws SystemException if a system exception occurred
	*/
	public java.util.List<com.mpower.pc.model.CommandHistory> findAll(
		int start, int end)
		throws com.liferay.portal.kernel.exception.SystemException;

	/**
	* Finds an ordered range of all the command histories.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param start the lower bound of the range of command histories to return
	* @param end the upper bound of the range of command histories to return (not inclusive)
	* @param orderByComparator the comparator to order the results by
	* @return the ordered range of command histories
	* @throws SystemException if a system exception occurred
	*/
	public java.util.List<com.mpower.pc.model.CommandHistory> findAll(
		int start, int end,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException;

	/**
	* Removes all the command histories where userId = &#63; from the database.
	*
	* @param userId the user id to search with
	* @throws SystemException if a system exception occurred
	*/
	public void removeByUserId(long userId)
		throws com.liferay.portal.kernel.exception.SystemException;

	/**
	* Removes all the command histories from the database.
	*
	* @throws SystemException if a system exception occurred
	*/
	public void removeAll()
		throws com.liferay.portal.kernel.exception.SystemException;

	/**
	* Counts all the command histories where userId = &#63;.
	*
	* @param userId the user id to search with
	* @return the number of matching command histories
	* @throws SystemException if a system exception occurred
	*/
	public int countByUserId(long userId)
		throws com.liferay.portal.kernel.exception.SystemException;

	/**
	* Counts all the command histories.
	*
	* @return the number of command histories
	* @throws SystemException if a system exception occurred
	*/
	public int countAll()
		throws com.liferay.portal.kernel.exception.SystemException;
}